<?php
	
	$ssFilter = $this->arrParam['ssFilter'];
	
	
	//-------SEARCH------------------------------------------
	$keywords = $this->formText('keywords',$ssFilter['keywords'],array('class'=>'txtshort'));
	$linkSearch = $this->baseUrl($this->currentController . '/filter/type/search/key/1');
	$btnSearch = $this->formSubmit('search-now','Tìm kiếm',
			array('onclick'=>"OnSubmitForm('" . $linkSearch . "')"));
	$linkResetSearch = $this->baseUrl($this->currentController . '/filter/type/search/key/0');
	$btnResetSearch = $this->formSubmit('clear-keywords','Xóa',
			array('onclick'=>"OnSubmitForm('" . $linkResetSearch . "')"));
	$strSearch = $keywords . ' ' . $btnSearch . ' ' . $btnResetSearch;
	
	
	//-------SORT --------------------------------------------
	//cmsLableSort($lable,$ssFilter,$colum,$linkSort,$linkImgSort,$defaultOrder = 'DESC')
	$linkSort	  = $this->baseUrl($this->currentController . '/filter/type/order');
	$lblGroupName = $this->cmsLableSort('Tên nhóm',$ssFilter,'g.group_name',$linkSort,$this->imgUrl );
	$lblID 		  = $this->cmsLableSort('ID',$ssFilter,'g.id',$linkSort,$this->imgUrl);
	$lblStatus 	  = $this->cmsLableSort('Trạng thái',$ssFilter,'g.status',$linkSort,$this->imgUrl);
	$lblACP 	  = $this->cmsLableSort('Quyền Admin',$ssFilter,'g.group_acp',$linkSort,$this->imgUrl);
	$lblMember 	  = $this->cmsLableSort('Số lượng',$ssFilter,'members',$linkSort,$this->imgUrl);
	
?>
<form name="appForm" method="post" action="">



                        <?php echo $this->render('admin-group/toolbar/index.php')?>
                        <div class="clr"></div>
                         <?php echo $this->render('admin-group/sublink/index.php')?>
                        <!-- BEGIN: CONTENT -->
                        <div id="element-box">
                            <div class="t">
                                <div class="t">
                                    <div class="t"></div>
                                </div>
                                
                            </div>
                            <div class="m">
                            	<div class = "filter">
                            		<div><?php echo $strSearch;?></div>
                            	</div>
                             <!-- BEGIN: ELEMENT BOX -->
							 <!-- Area 4: In du lieu lay tu database -->
                                <table class="adminlist">
                                    <thead>
                                        <tr>
                                            <th width="43" ><input type="checkbox" name="checkbox" id="checkbox" onclick="checkedAll()">
                                            </th>
                                            <th><?php echo $lblGroupName;?></th>
                                            <th width="89"><?php echo $lblStatus;?></th>
                                            <th width="83"><?php echo $lblACP;?></th>
                                         
                                            <th width="77"><?php echo $lblMember;?></th>
                                            <th width="90">Điều khiển</th>

                                            <th width="34"><?php echo $lblID;?></th>
                                        </tr>
                                    </thead>
									<?php 
										foreach($this->Items as $key => $val){
											$id 			= $val['id'];
											$group_name 	= $val['group_name'];
											$status = $val['status'];
											if($status ==1){
												//cmsIconButton($title ='',$linkImg, $link = null )
												$linkStatus  = $this->baseUrl($this->currentController . '/status/type/0/id/' . $id);
												$status = $this->cmsIconButton('Kích hoạt',$this->imgUrl.'/active.png',$linkStatus); 
											}else{
												$linkStatus  = $this->baseUrl($this->currentController . '/status/type/1/id/' . $id);
												$status = $this->cmsIconButton('Không kích hoạt',$this->imgUrl.'/inactive.png',$linkStatus); 
											}
											$group_acp 		= $val['group_acp'];
											if($group_acp ==1){
												$group_acp = $this->cmsIconButton('Có',$this->imgUrl.'/active.png'); 
											}else{
												$group_acp = $this->cmsIconButton('Không',$this->imgUrl.'/inactive.png');
											}
											$members 		= $val['members'];
											
											$linkInfo		= $this->baseUrl($this->currentController . '/info/id/' . $id);
											$btnInfo		= $this->cmsIconButton('Xem',$this->imgUrl.'/icon_info.png',$linkInfo);
											
											$linkEdit		= $this->baseUrl($this->currentController . '/edit/id/' . $id);
											$btnEdit		= $this->cmsIconButton('Sửa',$this->imgUrl.'/icon_edit.png',$linkEdit);
											
											$linkDelete		= $this->baseUrl($this->currentController . '/delete/id/' . $id);
											$btnDelete		= $this->cmsIconButton('Xóa',$this->imgUrl.'/icon_del.png',$linkDelete);
											
											$strIconButton = $btnInfo.' '.$btnEdit.' '.$btnDelete;
											$cid		   = $this->formCheckbox('cid[]',$val['id']);
									?>
                                    <tr class="even">						
                                        <td align="center"><?php echo $cid;?></td>
                                        <td align="left"><?php echo $group_name;?></td>
                                        <td align="center"><?php echo $status;?></td>
                                        <td align="center"><?php echo $group_acp;?></td>

                                        <td align="center"><?php echo $members;?></td>
                                        <td align="center"><?php echo $strIconButton;?></td>
                                        <td align="center"><?php echo $id;?></td>
                                    </tr>
                                    <?php 
										}
                                    ?>
                                    <!-- BEGIN: PAGINATION (FOOT) -->
                                    <tfoot>
                                        <tr>
                                            <td colspan="9">
                                                <div class="container">
                                                    <div class="pagination">
                                                    <?php 
                                                        $currentUrl = $this->baseUrl($this->currentController . '/index');
                                                        echo $this->paginationControl($this->paginator,'Sliding','pagination.phtml',array('currentUrl'=>$currentUrl));
                                                        ?>
                                                      
                                                    </div>
                                                </div>
                                            </td>
                                        </tr>					
                                    </tfoot>				
                                    <!-- END: PAGINATION (FOOT) -->
                                </table>
                                <!-- Area 4: In du lieu lay tu database - End -->

                                <!-- END: ELEMENT BOX -->	
                              <div class="clr"></div>
                            </div>
                            <div class="b">
                                <div class="b">
                                    <div class="b"></div>
                                </div>
                            </div>
                        </div>
                        <!-- END: 	CONTENT -->
                    </form>